package com.shaoyu.tools.testcase.pressuretest.intercept;

import com.shaoyu.spring.study.validate.annotation.ValidateFor;
import com.shaoyu.spring.study.validate.annotation.ValidateIntercept;
import com.shaoyu.spring.study.validate.core.ValidateContext;

/**
 * @Desc :
 * @Author: shaoyu
 * @Date : 2022/8/25 14:49
 */
@ValidateIntercept("interceptor")
public class Interceptor {

    @ValidateFor("test")
    public String validateString(String param) throws InterruptedException {
        Thread.sleep(1);
        System.out.println(param);
        return null;
    }

    @ValidateFor("testContext")
    public String testContext(Integer i) throws InterruptedException {
        Thread.sleep((long) (Math.random()*2000));
        ValidateContext.getCurrentContext().set("test",i);
        System.out.println(i);
        return null;
    }
}
